# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import fields, models, api, tools

class Consultant(models.Model):
    # 顾问
    _inherit = "res.partner"

    supplier_info_id = fields.Many2one(
        'product.supplierinfo', help="平台发放咨询费时, 基于此创建采购订单")


    sale_order_template_id = fields.Many2one(
        'sale.order.template', string=" Default SO Template",
        help="咨询者付咨询费时, 基于此创建销售订单")

    # consult_sale_order_template_ids = fields.One2many(
    #     'consult.sale.order.template', 'partner_id',
    #     help="咨询者付咨询费时, 基于此创建销售订单")


# class SaleOrderTemplate(models.Model):
#     _inherit = "sale.order.template"

#     user_id = fields.Many2one(
#         'res.users', string='Salesperson', index=True )

#     user_partner_id = fields.Many2one( 
#         'res.partner', related='user_id.partner_id',  help="销售员的 partner_id")

# class ConsultantSaleOrderTemplate(models.Model):
#     # 某顾问专用的 挂号单模版
#     # 不同情况下, 调整价格, 使用不同的销售订单模版

#     _name = "consult.sale.order.template"
#     _description = 'ConsultSurvey'
#     _order = "id"

#     partner_id = fields.Many2one( 'res.partner')
#     sale_order_template_id = fields.Many2one(
#         'sale.order.template', help="咨询者付咨询费时, 基于此创建销售订单")


class SaleOrder(models.Model):
    _inherit = "sale.order"

    user_partner_id = fields.Many2one( 
        'res.partner', related='user_id.partner_id',  help="销售员的 partner_id")

    # consult_survey_id = fields.Many2one(
    #     'consult.survey', string="Consult Survey", help="该次问诊, 使用这张调查表" )

    # consultation_id = fields.Many2one(
    #     'consult.consultation', string="Consultation", help="本次咨询的应答" )


